package org.gap.wizards.spells;

import org.gap.wizards.creature.Creature;
import org.gap.wizards.creature.Creature.Attribute;
import org.gap.wizards.effects.VisualEffect;
import org.gap.wizards.views.ViewPlatform;
import org.gap.wizards.world.Location;

public class Description {

	private final int cost;
	private final String name;
	private final String success;
	private final String failure;
	private final VisualEffect effect;

	public Description(int cost, String name, VisualEffect effect, String success, String failure) {
		this.cost = cost;
		this.name = name;
		this.effect = effect;
		this.success = success;
		this.failure = failure;
	}

	public void applyCost(Creature creature) {
		creature.decrease(Attribute.ManaPoints, cost);
	}

	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return name + " (" + cost + ")";
	}

	public String describeSuccessfulEffect() {
		return success;
	}

	public String describeFailEffect() {
		return failure;
	}

	public void showEffect(Location location, Creature target, ViewPlatform platform) {
		effect.setSource(location.getCharacterLocation());
		effect.setDestination(target.getLocation());
		effect.draw(platform);
	}
}
